package com.zhxt.common.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean<WebXssFilter> xssFilterRegistrationBean() {
        FilterRegistrationBean<WebXssFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new WebXssFilter());
        registrationBean.addUrlPatterns("/*"); // 拦截所有请求
        registrationBean.setOrder(1); // 设置过滤器的执行顺序
        return registrationBean;
    }
}